package ToYesterday.duplicateNumbers_03;

import java.util.HashSet;
import java.util.Set;

public class SolutionByHashMap {
    public int solutionByHashMap(int[] nums){
        Set<Integer> set = new HashSet<>();
        for (int i = 0;i<nums.length;i++){
            if (set.contains(nums[i]))return nums[i];
            set.add(nums[i]);
        }


        return 0;
    }
}
